<!DOCTYPE html>
<html>

<head>
  <title>Quarkus - Using Security with JDBC</title>
  <script id="adobe_dtm" src="https://www.redhat.com/dtm.js" type="text/javascript"></script>
  <script src="/assets/javascript/highlight.pack.js" type="text/javascript"></script>
  <META HTTP-EQUIV='Content-Security-Policy' CONTENT="default-src 'none'; script-src 'self' 'unsafe-eval' 'sha256-ANpuoVzuSex6VhqpYgsG25OHWVA1I+F6aGU04LoI+5s=' 'sha256-ipy9P/3rZZW06mTLAR0EnXvxSNcnfSDPLDuh3kzbB1w=' js.bizographics.com https://www.redhat.com assets.adobedtm.com jsonip.com https://ajax.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com https://use.fontawesome.com; style-src 'self' https://fonts.googleapis.com https://use.fontawesome.com; img-src 'self' *; media-src 'self' ; frame-src https://www.googletagmanager.com https://www.youtube.com; frame-ancestors 'none'; base-uri 'none'; object-src 'none'; form-action 'none'; font-src 'self' https://use.fontawesome.com https://fonts.gstatic.com;">
  <META HTTP-EQUIV='X-Frame-Options' CONTENT="DENY">
  <META HTTP-EQUIV='X-XSS-Protection' CONTENT="1; mode=block">
  <META HTTP-EQUIV='X-Content-Type-Options' CONTENT="nosniff">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Quarkus: Supersonic Subatomic Java">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@QuarkusIO"> 
  <meta name="twitter:creator" content="@QuarkusIO">
  <meta property="og:url" content="https://quarkus.io/guides/security-jdbc" />
  <meta property="og:title" content="Quarkus - Using Security with JDBC" />
  <meta property="og:description" content="Quarkus: Supersonic Subatomic Java" />
  <meta property="og:image" content="/assets/images/quarkus_card.png" />
  <link rel="canonical" href="https://quarkus.io/guides/security-jdbc">
  <link rel="shortcut icon" type="image/png" href="/favicon.ico" >
  <link rel="stylesheet" href="https://quarkus.io/guides/stylesheet/config.css" />
  <link rel="stylesheet" href="/assets/css/main.css" />
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
  <link rel="alternate" type="application/rss+xml"  href="https://quarkus.io/feed.xml" title="Quarkus">
  <script src="https://quarkus.io/assets/javascript/goan.js" type="text/javascript"></script>
  <script src="https://quarkus.io/assets/javascript/hl.js" type="text/javascript"></script>
</head>

<body class="guides">
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJWS5L"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <!-- End Google Tag Manager (noscript) -->

  <div class="nav-wrapper">
  <div class="grid-wrapper">
    <div class="width-12-12">
      <input type="checkbox" id="checkbox" />
      <nav id="main-nav" class="main-nav">
  <div class="container">
    <div class="logo-wrapper">
      
        <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_600px_reverse.png" class="project-logo" title="Quarkus"></a>
      
    </div>
    <label class="nav-toggle" for="checkbox">
      <i class="fa fa-bars"></i>
    </label>
    <div id="menu" class="menu">
      <span>
        <a href="/get-started/" class="">Get Started</a>
      </span>
      <span>
        <a href="/guides/" class="active">Guides</a>
      </span>
      <span>
        <a href="/community/" class="">Community</a>
      </span>
      <span>
        <a href="/support/" class="">Support</a>
      </span>
      <span>
        <a href="/blog/" class="">Blog</a>
      </span>
      <span>
        <a href="https://code.quarkus.io" class="button-cta secondary white">Start Coding</a>
      </span>
    </div>
  </div>
      </nav>
    </div>
  </div>
</div>

  <div class="content">
    <div class="guide">
  <div class="width-12-12">
    <h1 class="text-caps">Quarkus - Using Security with JDBC</h1>
    <div class="hide-mobile toc"><ul class="sectlevel1">
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#architecture">Architecture</a></li>
<li><a href="#solution">Solution</a></li>
<li><a href="#creating-the-maven-project">Creating the Maven Project</a></li>
<li><a href="#writing-the-application">Writing the application</a>
<ul class="sectlevel2">
<li><a href="#configuring-the-application">Configuring the Application</a></li>
</ul>
</li>
<li><a href="#testing-the-application">Testing the Application</a></li>
<li><a href="#advanced-configuration">Advanced Configuration</a></li>
<li><a href="#configuration-reference">Configuration Reference</a></li>
<li><a href="#future-work">Future Work</a></li>
</ul></div>
    <div>
      <div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>This guide demonstrates how your Quarkus application can use a database to store your user identities.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="prerequisites"><a class="anchor" href="#prerequisites"></a>Prerequisites</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To complete this guide, you need:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>less than 15 minutes</p>
</li>
<li>
<p>an IDE</p>
</li>
<li>
<p>JDK 1.8+ installed with <code>JAVA_HOME</code> configured appropriately</p>
</li>
<li>
<p>Apache Maven 3.6.2+</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="architecture"><a class="anchor" href="#architecture"></a>Architecture</h2>
<div class="sectionbody">
<div class="paragraph">
<p>In this example, we build a very simple microservice which offers three endpoints:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>/api/public</code></p>
</li>
<li>
<p><code>/api/users/me</code></p>
</li>
<li>
<p><code>/api/admin</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The <code>/api/public</code> endpoint can be accessed anonymously.
The <code>/api/admin</code> endpoint is protected with RBAC (Role-Based Access Control) where only users granted with the <code>admin</code> role can access. At this endpoint, we use the <code>@RolesAllowed</code> annotation to declaratively enforce the access constraint.
The <code>/api/users/me</code> endpoint is also protected with RBAC (Role-Based Access Control) where only users granted with the <code>user</code> role can access. As a response, it returns a JSON document with details about the user.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="solution"><a class="anchor" href="#solution"></a>Solution</h2>
<div class="sectionbody">
<div class="paragraph">
<p>We recommend that you follow the instructions in the next sections and create the application step by step.
However, you can go right to the completed example.</p>
</div>
<div class="paragraph">
<p>Clone the Git repository: <code>git clone <a href="https://github.com/quarkusio/quarkus-quickstarts.git" class="bare">https://github.com/quarkusio/quarkus-quickstarts.git</a></code>, or download an <a href="https://github.com/quarkusio/quarkus-quickstarts/archive/master.zip">archive</a>.</p>
</div>
<div class="paragraph">
<p>The solution is located in the <code>security-jdbc-quickstart</code> <a href="https://github.com/quarkusio/quarkus-quickstarts/tree/master/security-jdbc-quickstart">directory</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="creating-the-maven-project"><a class="anchor" href="#creating-the-maven-project"></a>Creating the Maven Project</h2>
<div class="sectionbody">
<div class="paragraph">
<p>First, we need a new project. Create a new project with the following command:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">mvn io.quarkus:quarkus-maven-plugin:1.7.0.Final:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=security-jdbc-quickstart \
    -Dextensions="elytron-security-jdbc, jdbc-postgresql, resteasy"
cd security-jdbc-quickstart</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Don&#8217;t forget to add the database connector library of choice. Here we are using PostgreSQL as identity store.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>This command generates a Maven project, importing the <code>elytron-security-jdbc</code> extension
which is an <a href="https://docs.wildfly.org/17/WildFly_Elytron_Security.html#jdbc-security-realm"><code>wildfly-elytron-realm-jdbc</code></a> adapter for Quarkus applications.</p>
</div>
<div class="paragraph">
<p>If you already have your Quarkus project configured, you can add the <code>elytron-security-jdbc</code> extension
to your project by running the following command in your project base directory:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="bash" class="language-bash hljs">./mvnw quarkus:add-extension -Dextensions="elytron-security-jdbc"</code></pre>
</div>
</div>
<div class="paragraph">
<p>This will add the following to your <code>pom.xml</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;dependency&gt;
    &lt;groupId&gt;io.quarkus&lt;/groupId&gt;
    &lt;artifactId&gt;quarkus-elytron-security-jdbc&lt;/artifactId&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="writing-the-application"><a class="anchor" href="#writing-the-application"></a>Writing the application</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Let&#8217;s start by implementing the <code>/api/public</code> endpoint. As you can see from the source code below, it is just a regular JAX-RS resource:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.security.jdbc;

import javax.annotation.security.PermitAll;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/api/public")
public class PublicResource {

    @GET
    @PermitAll
    @Produces(MediaType.TEXT_PLAIN)
    public String publicResource() {
        return "public";
   }
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>The source code for the <code>/api/admin</code> endpoint is also very simple. The main difference here is that we are using a <code>@RolesAllowed</code> annotation to make sure that only users granted with the <code>admin</code> role can access the endpoint:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.security.jdbc;

import javax.annotation.security.RolesAllowed;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/api/admin")
public class AdminResource {

    @GET
    @RolesAllowed("admin")
    @Produces(MediaType.TEXT_PLAIN)
    public String adminResource() {
         return "admin";
    }
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Finally, let&#8217;s consider the <code>/api/users/me</code> endpoint. As you can see from the source code below, we are trusting only users with the <code>user</code> role.
We are using <code>SecurityContext</code> to get access to the current authenticated Principal and we return the user&#8217;s name. This information is loaded from the database.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">package org.acme.security.jdbc;

import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.SecurityContext;

@Path("/api/users")
public class UserResource {

    @GET
    @RolesAllowed("user")
    @Path("/me")
    @Produces(MediaType.APPLICATION_JSON)
    public String me(@Context SecurityContext securityContext) {
        return securityContext.getUserPrincipal().getName();
    }
}</code></pre>
</div>
</div>
<div class="sect2">
<h3 id="configuring-the-application"><a class="anchor" href="#configuring-the-application"></a>Configuring the Application</h3>
<div class="paragraph">
<p>The <code>elytron-security-jdbc</code> extension requires at least one datasource to access to your database.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="properties" class="language-properties hljs">quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=quarkus
quarkus.datasource.password=quarkus
quarkus.datasource.jdbc.url=jdbc:postgresql:elytron-security-jdbc</code></pre>
</div>
</div>
<div class="paragraph">
<p>In our context, we are using PostgreSQL as identity store and we init the database with users and roles.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="sql" class="language-sql hljs">CREATE TABLE test_user (
  id INT,
  username VARCHAR(255),
  password VARCHAR(255),
  role VARCHAR(255)
);

INSERT INTO test_user (id, username, password, role) VALUES (1, 'admin', 'admin', 'admin');
INSERT INTO test_user (id, username, password, role) VALUES (2, 'user','user', 'user');</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>It is probably useless but we kindly remind you that you must not store clear-text passwords in production environment ;-).
The <code>elytron-security-jdbc</code> offers a built-in bcrypt password mapper.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>We can now configure the Elytron JDBC Realm.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="properties" class="language-properties hljs">quarkus.security.jdbc.enabled=true
quarkus.security.jdbc.principal-query.sql=SELECT u.password, u.role FROM test_user u WHERE u.username=? <i class="conum" data-value="1"></i><b>(1)</b>
quarkus.security.jdbc.principal-query.clear-password-mapper.enabled=true <i class="conum" data-value="2"></i><b>(2)</b>
quarkus.security.jdbc.principal-query.clear-password-mapper.password-index=1
quarkus.security.jdbc.principal-query.attribute-mappings.0.index=2 <i class="conum" data-value="3"></i><b>(3)</b>
quarkus.security.jdbc.principal-query.attribute-mappings.0.to=groups</code></pre>
</div>
</div>
<div class="paragraph">
<p>The <code>elytron-security-jdbc</code> extension requires at least one principal query to authenticate the user and its identity.</p>
</div>
<div class="colist arabic">
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>We define a parameterized SQL statement (with exactly 1 parameter) which should return the user&#8217;s password plus any additional information you want to load.</td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td>We  configure the password mapper with the position of the password field in the <code>SELECT</code> fields and other information like salt, hash encoding, etc.</td>
</tr>
<tr>
<td><i class="conum" data-value="3"></i><b>3</b></td>
<td>We use <code>attribute-mappings</code> to bind the <code>SELECT</code> projection fields (ie. <code>u.role</code> here) to the target Principal representation attributes.</td>
</tr>
</table>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>In the <code>principal-query</code> configuration all the <code>index</code> properties start at 1 (rather than 0).</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="testing-the-application"><a class="anchor" href="#testing-the-application"></a>Testing the Application</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The application is now protected and the identities are provided by our database.
The very first thing to check is to ensure the anonymous access works.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">$ curl -i -X GET http://localhost:8080/api/public
HTTP/1.1 200 OK
Content-Length: 6
Content-Type: text/plain;charset=UTF-8

public%</code></pre>
</div>
</div>
<div class="paragraph">
<p>Now, let&#8217;s try a to hit a protected resource anonymously.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">$ curl -i -X GET http://localhost:8080/api/admin
HTTP/1.1 401 Unauthorized
Content-Length: 14
Content-Type: text/html;charset=UTF-8

Not authorized%</code></pre>
</div>
</div>
<div class="paragraph">
<p>So far so good, now let&#8217;s try with an allowed user.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">$ curl -i -X GET -u admin:admin http://localhost:8080/api/admin
HTTP/1.1 200 OK
Content-Length: 5
Content-Type: text/plain;charset=UTF-8

admin%</code></pre>
</div>
</div>
<div class="paragraph">
<p>By providing the <code>admin:admin</code> credentials, the extension authenticated the user and loaded their roles.
The <code>admin</code> user is authorized to access to the protected resources.</p>
</div>
<div class="paragraph">
<p>The user <code>admin</code> should be forbidden to access a resource protected with <code>@RolesAllowed("user")</code> because it doesn&#8217;t have this role.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">$ curl -i -X GET -u admin:admin http://localhost:8080/api/users/me
HTTP/1.1 403 Forbidden
Content-Length: 34
Content-Type: text/html;charset=UTF-8

Forbidden%</code></pre>
</div>
</div>
<div class="paragraph">
<p>Finally, using the user <code>user</code> works and the security context contains the principal details (username for instance).</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="shell" class="language-shell hljs">curl -i -X GET -u user:user http://localhost:8080/api/users/me
HTTP/1.1 200 OK
Content-Length: 4
Content-Type: text/plain;charset=UTF-8

user%</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="advanced-configuration"><a class="anchor" href="#advanced-configuration"></a>Advanced Configuration</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This guide only covered an easy use case, the extension offers multiple datasources, multiple principal queries configuration as well as a bcrypt password mapper.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="properties" class="language-properties hljs">quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=quarkus
quarkus.datasource.password=quarkus
quarkus.datasource.jdbc.url=jdbc:postgresql:multiple-data-sources-users

quarkus.datasource.permissions.db-kind=postgresql
quarkus.datasource.permissions.username=quarkus
quarkus.datasource.permissions.password=quarkus
quarkus.datasource.permissions.jdbc.url=jdbc:postgresql:multiple-data-sources-permissions

quarkus.security.jdbc.enabled=true
quarkus.security.jdbc.principal-query.sql=SELECT u.password FROM test_user u WHERE u.username=?
quarkus.security.jdbc.principal-query.clear-password-mapper.enabled=true
quarkus.security.jdbc.principal-query.clear-password-mapper.password-index=1

quarkus.security.jdbc.principal-query.roles.sql=SELECT r.role_name FROM test_role r, test_user_role ur WHERE ur.username=? AND ur.role_id = r.id
quarkus.security.jdbc.principal-query.roles.datasource=permissions
quarkus.security.jdbc.principal-query.roles.attribute-mappings.0.index=1
quarkus.security.jdbc.principal-query.roles.attribute-mappings.0.to=groups</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="configuration-reference"><a class="anchor" href="#configuration-reference"></a>Configuration Reference</h2>
<div class="sectionbody">
<div class="paragraph configuration-legend">
<p><span class="icon"><i class="fa fa-lock" title="Fixed at build time"></i></span> Configuration property fixed at build time - All other configuration properties are overridable at runtime</p>
</div>
<table class="tableblock frame-all grid-all stretch configuration-reference searchable">
<colgroup>
<col style="width: 80%;">
<col style="width: 10%;">
<col style="width: 10%;">
</colgroup>
<tbody>
<tr>
<th class="tableblock halign-left valign-top"><p class="tableblock"><a id="quarkus-elytron-security-jdbc_configuration"></a><a href="#quarkus-elytron-security-jdbc_configuration">Configuration property</a></p></th>
<th class="tableblock halign-left valign-middle"><p class="tableblock">Type</p></th>
<th class="tableblock halign-left valign-middle"><p class="tableblock">Default</p></th>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><span class="icon"><i class="fa fa-lock" title="Fixed at build time"></i></span> <a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.realm-name"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.realm-name">quarkus.security.jdbc.realm-name</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The realm name</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>Quarkus</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><span class="icon"><i class="fa fa-lock" title="Fixed at build time"></i></span> <a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.enabled"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.enabled">quarkus.security.jdbc.enabled</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>If the properties store is enabled.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.sql"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.sql">quarkus.security.jdbc.principal-query.sql</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The sql query to find the password</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.datasource"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.datasource">quarkus.security.jdbc.principal-query.datasource</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The data source to use</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.clear-password-mapper.enabled"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.clear-password-mapper.enabled">quarkus.security.jdbc.principal-query.clear-password-mapper.enabled</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>If the clear-password-mapper is enabled.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.clear-password-mapper.password-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.clear-password-mapper.password-index">quarkus.security.jdbc.principal-query.clear-password-mapper.password-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the clear password</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>1</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.enabled"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.enabled">quarkus.security.jdbc.principal-query.bcrypt-password-mapper.enabled</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>If the bcrypt-password-mapper is enabled.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.password-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.password-index">quarkus.security.jdbc.principal-query.bcrypt-password-mapper.password-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the password hash</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.hash-encoding"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.hash-encoding">quarkus.security.jdbc.principal-query.bcrypt-password-mapper.hash-encoding</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>A string referencing the password hash encoding ("BASE64" or "HEX")</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code>, <code>hex</code></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.salt-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.salt-index">quarkus.security.jdbc.principal-query.bcrypt-password-mapper.salt-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the Bcrypt salt</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.salt-encoding"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.salt-encoding">quarkus.security.jdbc.principal-query.bcrypt-password-mapper.salt-encoding</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>A string referencing the salt encoding ("BASE64" or "HEX")</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code>, <code>hex</code></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.iteration-count-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.bcrypt-password-mapper.iteration-count-index">quarkus.security.jdbc.principal-query.bcrypt-password-mapper.iteration-count-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the Bcrypt iteration count</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.attribute-mappings.-attribute-mappings-.index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.attribute-mappings.-attribute-mappings-.index">quarkus.security.jdbc.principal-query.attribute-mappings."attribute-mappings".index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of column to map</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.attribute-mappings.-attribute-mappings-.to"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.attribute-mappings.-attribute-mappings-.to">quarkus.security.jdbc.principal-query.attribute-mappings."attribute-mappings".to</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The target attribute name</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">required <span class="icon"><i class="fa fa-exclamation-circle" title="Configuration property is required"></i></span></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.sql"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.sql">quarkus.security.jdbc.principal-query."named-principal-queries".sql</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The sql query to find the password</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.datasource"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.datasource">quarkus.security.jdbc.principal-query."named-principal-queries".datasource</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The data source to use</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.attribute-mappings.-attribute-mappings-.index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.attribute-mappings.-attribute-mappings-.index">quarkus.security.jdbc.principal-query."named-principal-queries".attribute-mappings."attribute-mappings".index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of column to map</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.attribute-mappings.-attribute-mappings-.to"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.attribute-mappings.-attribute-mappings-.to">quarkus.security.jdbc.principal-query."named-principal-queries".attribute-mappings."attribute-mappings".to</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The target attribute name</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">required <span class="icon"><i class="fa fa-exclamation-circle" title="Configuration property is required"></i></span></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.clear-password-mapper.enabled"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.clear-password-mapper.enabled">quarkus.security.jdbc.principal-query."named-principal-queries".clear-password-mapper.enabled</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>If the clear-password-mapper is enabled.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.clear-password-mapper.password-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.clear-password-mapper.password-index">quarkus.security.jdbc.principal-query."named-principal-queries".clear-password-mapper.password-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the clear password</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>1</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.enabled"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.enabled">quarkus.security.jdbc.principal-query."named-principal-queries".bcrypt-password-mapper.enabled</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>If the bcrypt-password-mapper is enabled.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.password-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.password-index">quarkus.security.jdbc.principal-query."named-principal-queries".bcrypt-password-mapper.password-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the password hash</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.hash-encoding"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.hash-encoding">quarkus.security.jdbc.principal-query."named-principal-queries".bcrypt-password-mapper.hash-encoding</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>A string referencing the password hash encoding ("BASE64" or "HEX")</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code>, <code>hex</code></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.salt-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.salt-index">quarkus.security.jdbc.principal-query."named-principal-queries".bcrypt-password-mapper.salt-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the Bcrypt salt</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.salt-encoding"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.salt-encoding">quarkus.security.jdbc.principal-query."named-principal-queries".bcrypt-password-mapper.salt-encoding</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>A string referencing the salt encoding ("BASE64" or "HEX")</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code>, <code>hex</code></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>base64</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.iteration-count-index"></a><code><a href="#quarkus-elytron-security-jdbc_quarkus.security.jdbc.principal-query.-named-principal-queries-.bcrypt-password-mapper.iteration-count-index">quarkus.security.jdbc.principal-query."named-principal-queries".bcrypt-password-mapper.iteration-count-index</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The index (1 based numbering) of the column containing the Bcrypt iteration count</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0</code></p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="sect1">
<h2 id="future-work"><a class="anchor" href="#future-work"></a>Future Work</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p>Propose more password mappers.</p>
</li>
<li>
<p>Provide an opinionated configuration.</p>
</li>
</ul>
</div>
</div>
</div>
    </div>
  </div>
</div>

  </div>

  <div class="content project-footer">
  <div class="footer-section">
    <div class="logo-wrapper">
      <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_reverse.svg" class="project-logo" title="Quarkus"></a>
    </div>
  </div>
  <div class="grid-wrapper">
    <p class="grid__item width-3-12">Quarkus is open. All dependencies of this project are available under the <a href='https://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache Software License 2.0</a> or compatible license.<br /><br />This website was built with <a href='https://jekyllrb.com/' target='_blank'>Jekyll</a>, is hosted on <a href='https://pages.github.com/' target='_blank'>Github Pages</a> and is completely open source. If you want to make it better, <a href='https://github.com/quarkusio/quarkusio.github.io' target='_blank'>fork the website</a> and show us what you’ve got.</p>

    
      <div class="width-1-12 project-links">
        <span>Navigation</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="/">Home</a></li>
          
            <li><a href="/guides">Guides</a></li>
          
            <li><a href="/community/#contributing">Contribute</a></li>
          
            <li><a href="/faq">FAQ</a></li>
          
            <li><a href="/get-started">Get Started</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Contribute</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://twitter.com/quarkusio">Follow us</a></li>
          
            <li><a href="https://github.com/quarkusio">GitHub</a></li>
          
            <li><a href="/security">Security&nbsp;policy</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Get Help</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://groups.google.com/forum/#!forum/quarkus-dev">Forums</a></li>
          
            <li><a href="https://quarkusio.zulipchat.com">Chatroom</a></li>
          
        </ul>
      </div>
    

    
      <div class="width-3-12 more-links">
        <span>Quarkus is made of community projects</span>
        <ul class="footer-links">
          
            <li><a href="https://vertx.io/" target="_blank">Eclipse Vert.x</a></li>
          
            <li><a href="https://microprofile.io" target="_blank">Eclipse MicroProfile</a></li>
          
            <li><a href="https://hibernate.org" target="_blank">Hibernate</a></li>
          
            <li><a href="https://netty.io" target="_blank">Netty</a></li>
          
            <li><a href="https://resteasy.github.io" target="_blank">RESTEasy</a></li>
          
            <li><a href="https://camel.apache.org" target="_blank">Apache Camel</a></li>
          
            <li><a href="https://code.quarkus.io/" target="_blank">And many more...</a></li>
          
        </ul>
      </div>
    
  </div>
</div>
  <div class="content redhat-footer">
  <div class="grid-wrapper">
    <span class="licence">
      <i class="fab fa-creative-commons"></i><i class="fab fa-creative-commons-by"></i> <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC by 3.0</a> | <a href="https://www.redhat.com/en/about/privacy-policy">Privacy Policy</a>
    </span>
    <span class="redhat">
      Sponsored by
    </span>
    <span class="redhat-logo">
      <a href="https://www.redhat.com/" target="_blank"><img src="/assets/images/redhat_reversed.svg"></a>
    </span>
  </div>
</div>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script>
  <script type="text/javascript" src="/assets/javascript/mobile-nav.js"></script>
  <script type="text/javascript" src="/assets/javascript/scroll-down.js"></script>
  <script src="/assets/javascript/satellite.js" type="text/javascript"></script>
  <script src="https://quarkus.io/guides/javascript/config.js" type="text/javascript"></script>
  <script src="/assets/javascript/search-filter.js" type="text/javascript"></script>
  <script src="/assets/javascript/back-to-top.js" type="text/javascript"></script>
</body>

</html>
